package hms.HotelAdministrationModule;

import hms.generic.*;
import hms.inventory.*;

import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;

import javax.swing.*;
import javax.swing.GroupLayout.*;
import javax.swing.LayoutStyle.*;
import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.table.*;

/**
 * <h2>ManageInventoryControl manages the inventory process. An Inventory object
 * contains a list of entries, each entry with the following: InventoryEntry
 * Name, InventoryEntry Category, Vendor, Size, Quantity, Price.
 * 
 * @author Akilah McIntyre
 */
public class ManageInventoryView extends AbstractGlobalView {

	private Inventory inventory; // Inventory for HMS instance

	@SuppressWarnings("unused")
	private ConfigInventoryFieldsView configInventoryFieldsView;

	/* View "Configure Inventory Specifications" functionality */
	private ConfigInventoryFieldsControl configInventoryFieldsControl;
	private JButton deleteEntryButton;
	private JButton resetEntryButton;
	private JList itemCatalog_jList;
	private JList colors_jList;
	private JList categories_jList;
	private JList vendors_jList;
	private JList sizes_jList;
	private JPanel invTablePanel;
	private JPanel invFieldsPanel;
	private JScrollPane catalogScrollPane;
	private JScrollPane colorsScrollPane;
	private JScrollPane categoriesScrollPane;
	private JScrollPane vendorsScrollPane;
	private JScrollPane sizesScrollPane;
	private JScrollPane invTableScrollPane;
	private JTable invTable;
	private JPanel initPane;
	private JButton newCfgItmSpecsButton;
	private JTextField categoryTextField;
	private int selIndxColor = -1;
	private int selIndxSize = -1;
	private int selIndxCatlgItem = -1;
	private int selIndxItemCategory = -1;
	private int selIndxVendor = -1;
	private int selIndxEntry = -1;

	private InvColor selectedColor = null;
	private Size selectedSize = null;
	private CatalogItem selectedCatlgItem = null;
	private ItemCategory selectedItemCategory = null;
	private Vendor selectedVendor = null;
	private InventoryEntry selectedEntry = null;
	private JTextField catalogTextField;
	private JPanel categoryPanel1;
	private JTextField textField;
	private JPanel vendorPanel1;
	private JTextField vendorTextField;
	private JPanel sizePanel1;
	private JTextField sizeTextField;
	private JPanel colorPanel1;
	private JTextField colorTextField;
	private JPanel pricePanel;
	private JTextField priceTextField;
	private JPanel qtyPanel;
	private JTextField quantityTextField;

	private JButton updateEntryButton;

	private JButton addEntryButton;

	private JButton clearEntryButton;

	public ManageInventoryView() {
		initConfigItemSpecsControl();
		initComponents();
		super.update(initPane);
		super.display();
	}

	private void initConfigItemSpecsControl() {
		configInventoryFieldsControl = new ConfigInventoryFieldsControl();
		configInventoryFieldsControl.init();
		inventory = new Inventory();
		inventory.initEntries();
	}

	private void initComponents() {
		initPane = new JPanel();
		initPane.setAlignmentX(Component.LEFT_ALIGNMENT);
		initPane.setAlignmentY(Component.TOP_ALIGNMENT);
		initPane.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Manage Inventory",
				TitledBorder.LEADING, TitledBorder.TOP, null, null));
		invTablePanel = new JPanel();
		invTablePanel.setAlignmentY(Component.TOP_ALIGNMENT);

		invTablePanel.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Inventory",
				TitledBorder.LEADING, TitledBorder.TOP, null, null));

		newCfgItmSpecsButton = new JButton("Configure Inventory Field Values");
		newCfgItmSpecsButton.setActionCommand("newCfgItmSpecsButton");
		newCfgItmSpecsButton.addActionListener(this);

		JLabel lblNewLabel = new JLabel("Manage Inventory View");
		lblNewLabel
				.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
		invTableScrollPane = new JScrollPane();
		invTableScrollPane.setAutoscrolls(true);
		invTable = new JTable();
		invTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

		invTable.setModel(inventory);
		invTable.setRowSelectionAllowed(true);

		TableSelectionListener tableListener = new TableSelectionListener(
				invTable);
		invTable.getSelectionModel().addListSelectionListener(tableListener);
		invTable.getColumnModel().getSelectionModel()
				.addListSelectionListener(tableListener);
		invTableScrollPane.setViewportView(invTable);

		deleteEntryButton = new JButton();
		deleteEntryButton.setActionCommand("deleteEntryButton");
		deleteEntryButton.setText("Delete Entry");
		deleteEntryButton.addActionListener(this);
		deleteEntryButton.setEnabled(false);
		
		vendorTextField = new JTextField();
		vendorTextField.setColumns(10);
		invFieldsPanel = new JPanel();
		invFieldsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
		invFieldsPanel.setAlignmentY(Component.TOP_ALIGNMENT);

		invFieldsPanel.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Fields",
				TitledBorder.LEADING, TitledBorder.TOP, null,
				new Color(0, 0, 0)));
		catalogScrollPane = new JScrollPane();
		catalogScrollPane.setAutoscrolls(true);
		catalogScrollPane
				.setBorder(new TitledBorder(new EtchedBorder(
						EtchedBorder.LOWERED, null, null), "Item Catalog",
						TitledBorder.CENTER, TitledBorder.TOP, null, new Color(
								0, 0, 0)));
		itemCatalog_jList = new JList(configInventoryFieldsControl.catalog);
		itemCatalog_jList
				.addListSelectionListener(createItemCatalogListSelectionListener());

		sizesScrollPane = new JScrollPane();
		sizesScrollPane.setAutoscrolls(true);
		sizesScrollPane.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Sizes",
				TitledBorder.LEADING, TitledBorder.TOP, null, null));

		sizes_jList = new JList(configInventoryFieldsControl.sizes);
		sizes_jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		sizes_jList
				.addListSelectionListener(createSizesListSelectionListener());

		sizesScrollPane.setViewportView(sizes_jList);

		itemCatalog_jList = new JList(configInventoryFieldsControl.catalog);

		itemCatalog_jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		itemCatalog_jList
				.addListSelectionListener(createItemCatalogListSelectionListener());

		catalogScrollPane.setViewportView(itemCatalog_jList);
		colorsScrollPane = new JScrollPane();
		colorsScrollPane.setAutoscrolls(true);
		colorsScrollPane.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Colors",
				TitledBorder.CENTER, TitledBorder.TOP, null, new Color(59, 59,
						59)));
		colors_jList = new JList(configInventoryFieldsControl.colors);
		colors_jList
				.addListSelectionListener(createColorsListSelectionListener());
		colors_jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

		colorsScrollPane.setViewportView(colors_jList);
		categoriesScrollPane = new JScrollPane();
		categoriesScrollPane.setAutoscrolls(true);
		categoriesScrollPane.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Catgories",
				TitledBorder.CENTER, TitledBorder.TOP, null, new Color(59, 59,
						59)));
		categories_jList = new JList(configInventoryFieldsControl.categories);
		categories_jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		categories_jList
				.addListSelectionListener(createItemCategoryListSelectionListener());
		categoriesScrollPane.setViewportView(categories_jList);
		vendorsScrollPane = new JScrollPane();
		vendorsScrollPane.setAutoscrolls(true);
		vendorsScrollPane.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Vendors",
				TitledBorder.LEADING, TitledBorder.TOP, null, null));
		vendors_jList = new JList(configInventoryFieldsControl.vendors);

		vendors_jList
				.addListSelectionListener(createVendorsListSelectionListener());

		vendorsScrollPane.setViewportView(vendors_jList);

		JPanel entryPanel = new JPanel();
		entryPanel.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Add/Edit Entry",
				TitledBorder.LEADING, TitledBorder.TOP, null, null));
		entryPanel.setAlignmentY(Component.TOP_ALIGNMENT);
		entryPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
		GroupLayout gl_initPane = new GroupLayout(initPane);
		gl_initPane.setHorizontalGroup(
			gl_initPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_initPane.createSequentialGroup()
					.addGroup(gl_initPane.createParallelGroup(Alignment.LEADING, false)
						.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 0, GroupLayout.PREFERRED_SIZE)
						.addGroup(gl_initPane.createSequentialGroup()
							.addGap(227)
							.addComponent(newCfgItmSpecsButton, GroupLayout.PREFERRED_SIZE, 230, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_initPane.createSequentialGroup()
							.addContainerGap()
							.addComponent(invFieldsPanel, GroupLayout.PREFERRED_SIZE, 888, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_initPane.createSequentialGroup()
							.addGap(16)
							.addComponent(entryPanel, GroupLayout.PREFERRED_SIZE, 891, GroupLayout.PREFERRED_SIZE)))
					.addGap(180))
				.addGroup(gl_initPane.createSequentialGroup()
					.addComponent(invTablePanel, GroupLayout.DEFAULT_SIZE, 1065, Short.MAX_VALUE)
					.addContainerGap())
		);
		gl_initPane.setVerticalGroup(
			gl_initPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_initPane.createSequentialGroup()
					.addGroup(gl_initPane.createParallelGroup(Alignment.LEADING)
						.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 0, GroupLayout.PREFERRED_SIZE)
						.addComponent(newCfgItmSpecsButton, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(invTablePanel, GroupLayout.PREFERRED_SIZE, 193, GroupLayout.PREFERRED_SIZE)
					.addGap(3)
					.addComponent(entryPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(invFieldsPanel, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(12, Short.MAX_VALUE))
		);

		JPanel catalogPanel = new JPanel();
		catalogPanel.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Item", TitledBorder.CENTER,
				TitledBorder.TOP, null, new Color(0, 0, 0)));

		catalogTextField = new JTextField();
		catalogTextField.setBackground(new Color(248, 248, 255));
		catalogTextField.setEditable(false);
		catalogTextField.setColumns(10);
		GroupLayout gl_catalogPanel = new GroupLayout(catalogPanel);
		gl_catalogPanel.setHorizontalGroup(gl_catalogPanel.createParallelGroup(
				Alignment.LEADING).addGroup(
				gl_catalogPanel
						.createSequentialGroup()
						.addGap(10)
						.addComponent(catalogTextField,
								GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)
						.addContainerGap()));
		gl_catalogPanel.setVerticalGroup(gl_catalogPanel.createParallelGroup(
				Alignment.LEADING).addGroup(
				gl_catalogPanel
						.createSequentialGroup()
						.addComponent(catalogTextField,
								GroupLayout.PREFERRED_SIZE, 25,
								GroupLayout.PREFERRED_SIZE)
						.addContainerGap(6, Short.MAX_VALUE)));
		catalogPanel.setLayout(gl_catalogPanel);

		updateEntryButton = new JButton();
		updateEntryButton.setText("Update Entry");
		updateEntryButton.setActionCommand("updateEntryButton");
		updateEntryButton.addActionListener(this);
		updateEntryButton.setEnabled(false);

		addEntryButton = new JButton();
		addEntryButton.setText("Add Entry");
		addEntryButton.setActionCommand("addEntryButton");
		addEntryButton.addActionListener(this);

		resetEntryButton = new JButton();
		resetEntryButton.setActionCommand("resetEntryButton");
		resetEntryButton.setText("Reset Entry");
		resetEntryButton.addActionListener(this);
		resetEntryButton.setEnabled(false);

		categoryPanel1 = new JPanel();
		categoryPanel1
				.setBorder(new TitledBorder(new EtchedBorder(
						EtchedBorder.LOWERED, null, null), "Category",
						TitledBorder.CENTER, TitledBorder.TOP, null, new Color(
								0, 0, 0)));

		categoryTextField = new JTextField();
		categoryTextField.setBackground(new Color(248, 248, 255));
		categoryTextField.setEditable(false);
		categoryTextField.setColumns(10);
		GroupLayout gl_categoryPanel1 = new GroupLayout(categoryPanel1);
		gl_categoryPanel1.setHorizontalGroup(gl_categoryPanel1
				.createParallelGroup(Alignment.LEADING).addGroup(
						gl_categoryPanel1
								.createSequentialGroup()
								.addContainerGap()
								.addComponent(categoryTextField,
										GroupLayout.DEFAULT_SIZE, 135,
										Short.MAX_VALUE).addContainerGap()));
		gl_categoryPanel1.setVerticalGroup(gl_categoryPanel1
				.createParallelGroup(Alignment.LEADING).addGroup(
						gl_categoryPanel1
								.createSequentialGroup()
								.addComponent(categoryTextField,
										GroupLayout.PREFERRED_SIZE, 25,
										GroupLayout.PREFERRED_SIZE)
								.addContainerGap(GroupLayout.DEFAULT_SIZE,
										Short.MAX_VALUE)));
		categoryPanel1.setLayout(gl_categoryPanel1);

		vendorPanel1 = new JPanel();
		vendorPanel1
				.setBorder(new TitledBorder(new EtchedBorder(
						EtchedBorder.LOWERED, null, null), "Vendor",
						TitledBorder.CENTER, TitledBorder.TOP, null, new Color(
								0, 0, 0)));

		vendorTextField.setBackground(new Color(248, 248, 255));
		vendorTextField.setEditable(false);
		vendorTextField.setColumns(10);
		GroupLayout gl_vendorPanel1 = new GroupLayout(vendorPanel1);
		gl_vendorPanel1.setHorizontalGroup(gl_vendorPanel1
				.createParallelGroup(Alignment.LEADING)
				.addGap(0, 124, Short.MAX_VALUE)
				.addGroup(
						gl_vendorPanel1
								.createSequentialGroup()
								.addContainerGap()
								.addComponent(vendorTextField,
										GroupLayout.DEFAULT_SIZE, 100,
										Short.MAX_VALUE).addContainerGap()));
		gl_vendorPanel1.setVerticalGroup(gl_vendorPanel1
				.createParallelGroup(Alignment.LEADING)
				.addGap(0, 59, Short.MAX_VALUE)
				.addGroup(
						gl_vendorPanel1
								.createSequentialGroup()
								.addComponent(vendorTextField,
										GroupLayout.PREFERRED_SIZE,
										GroupLayout.DEFAULT_SIZE,
										GroupLayout.PREFERRED_SIZE)
								.addContainerGap(12, Short.MAX_VALUE)));
		vendorPanel1.setLayout(gl_vendorPanel1);

		sizePanel1 = new JPanel();
		sizePanel1.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Size", TitledBorder.CENTER,
				TitledBorder.TOP, null, new Color(0, 0, 0)));

		sizeTextField = new JTextField();
		sizeTextField.setBackground(new Color(248, 248, 255));
		sizeTextField.setEditable(false);
		sizeTextField.setColumns(10);
		GroupLayout gl_sizePanel1 = new GroupLayout(sizePanel1);
		gl_sizePanel1.setHorizontalGroup(gl_sizePanel1
				.createParallelGroup(Alignment.LEADING)
				.addGap(0, 124, Short.MAX_VALUE)
				.addGroup(
						gl_sizePanel1
								.createSequentialGroup()
								.addContainerGap()
								.addComponent(sizeTextField,
										GroupLayout.DEFAULT_SIZE, 100,
										Short.MAX_VALUE).addContainerGap()));
		gl_sizePanel1.setVerticalGroup(gl_sizePanel1
				.createParallelGroup(Alignment.LEADING)
				.addGap(0, 59, Short.MAX_VALUE)
				.addGroup(
						gl_sizePanel1
								.createSequentialGroup()
								.addComponent(sizeTextField,
										GroupLayout.PREFERRED_SIZE,
										GroupLayout.DEFAULT_SIZE,
										GroupLayout.PREFERRED_SIZE)
								.addContainerGap(12, Short.MAX_VALUE)));
		sizePanel1.setLayout(gl_sizePanel1);

		colorPanel1 = new JPanel();
		colorPanel1
				.setBorder(new TitledBorder(new EtchedBorder(
						EtchedBorder.LOWERED, null, null), "Color",
						TitledBorder.CENTER, TitledBorder.TOP, null, new Color(
								0, 0, 0)));

		colorTextField = new JTextField();
		colorTextField.setBackground(new Color(248, 248, 255));
		colorTextField.setEditable(false);
		colorTextField.setColumns(10);
		GroupLayout gl_colorPanel1 = new GroupLayout(colorPanel1);
		gl_colorPanel1.setHorizontalGroup(gl_colorPanel1
				.createParallelGroup(Alignment.LEADING)
				.addGap(0, 124, Short.MAX_VALUE)
				.addGroup(
						gl_colorPanel1
								.createSequentialGroup()
								.addContainerGap()
								.addComponent(colorTextField,
										GroupLayout.DEFAULT_SIZE, 100,
										Short.MAX_VALUE).addContainerGap()));
		gl_colorPanel1.setVerticalGroup(gl_colorPanel1
				.createParallelGroup(Alignment.LEADING)
				.addGap(0, 59, Short.MAX_VALUE)
				.addGroup(
						gl_colorPanel1
								.createSequentialGroup()
								.addComponent(colorTextField,
										GroupLayout.PREFERRED_SIZE,
										GroupLayout.DEFAULT_SIZE,
										GroupLayout.PREFERRED_SIZE)
								.addContainerGap(12, Short.MAX_VALUE)));
		colorPanel1.setLayout(gl_colorPanel1);

		pricePanel = new JPanel();
		pricePanel.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Price",
				TitledBorder.CENTER, TitledBorder.TOP, null, null));

		qtyPanel = new JPanel();
		qtyPanel.setBorder(new TitledBorder(new EtchedBorder(
				EtchedBorder.LOWERED, null, null), "Quantity",
				TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 0, 0)));

		quantityTextField =  new JFormattedTextField(new DecimalFormat("###,####,####"));
		quantityTextField.setColumns(10);
		quantityTextField.setBackground(new Color(248, 248, 255));
		GroupLayout gl_qtyPanel = new GroupLayout(qtyPanel);
		gl_qtyPanel.setHorizontalGroup(gl_qtyPanel
				.createParallelGroup(Alignment.LEADING)
				.addGap(0, 175, Short.MAX_VALUE)
				.addGroup(
						gl_qtyPanel
								.createSequentialGroup()
								.addContainerGap()
								.addComponent(quantityTextField,
										GroupLayout.PREFERRED_SIZE, 143,
										GroupLayout.PREFERRED_SIZE)
								.addContainerGap(GroupLayout.DEFAULT_SIZE,
										Short.MAX_VALUE)));
		gl_qtyPanel.setVerticalGroup(gl_qtyPanel
				.createParallelGroup(Alignment.LEADING)
				.addGap(0, 62, Short.MAX_VALUE)
				.addGroup(
						gl_qtyPanel
								.createSequentialGroup()
								.addComponent(quantityTextField,
										GroupLayout.PREFERRED_SIZE, 25,
										GroupLayout.PREFERRED_SIZE)
								.addContainerGap(22, Short.MAX_VALUE)));
		qtyPanel.setLayout(gl_qtyPanel);
		GroupLayout gl_entryPanel = new GroupLayout(entryPanel);
		gl_entryPanel
				.setHorizontalGroup(gl_entryPanel
						.createParallelGroup(Alignment.TRAILING)
						.addGroup(
								gl_entryPanel
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												gl_entryPanel
														.createParallelGroup(
																Alignment.LEADING,
																false)
														.addComponent(
																catalogPanel,
																GroupLayout.PREFERRED_SIZE,
																175,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																pricePanel,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												ComponentPlacement.RELATED)
										.addGroup(
												gl_entryPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_entryPanel
																		.createSequentialGroup()
																		.addComponent(
																				categoryPanel1,
																				GroupLayout.PREFERRED_SIZE,
																				175,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				ComponentPlacement.RELATED)
																		.addComponent(
																				colorPanel1,
																				GroupLayout.PREFERRED_SIZE,
																				175,
																				GroupLayout.PREFERRED_SIZE)
																		.addGap(10)
																		.addComponent(
																				vendorPanel1,
																				GroupLayout.PREFERRED_SIZE,
																				160,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				ComponentPlacement.RELATED,
																				GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE)
																		.addComponent(
																				sizePanel1,
																				GroupLayout.PREFERRED_SIZE,
																				160,
																				GroupLayout.PREFERRED_SIZE))
														.addGroup(
																gl_entryPanel
																		.createSequentialGroup()
																		.addComponent(
																				qtyPanel,
																				GroupLayout.PREFERRED_SIZE,
																				175,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				ComponentPlacement.UNRELATED)
																		.addComponent(
																				addEntryButton,
																				GroupLayout.PREFERRED_SIZE,
																				116,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				ComponentPlacement.RELATED)
																		.addComponent(
																				resetEntryButton,
																				GroupLayout.PREFERRED_SIZE,
																				116,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				ComponentPlacement.RELATED)
																		.addComponent(
																				updateEntryButton,
																				GroupLayout.PREFERRED_SIZE,
																				116,
																				GroupLayout.PREFERRED_SIZE)))
										.addContainerGap()));
		gl_entryPanel
				.setVerticalGroup(gl_entryPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_entryPanel
										.createSequentialGroup()
										.addGroup(
												gl_entryPanel
														.createParallelGroup(
																Alignment.LEADING,
																false)
														.addGroup(
																gl_entryPanel
																		.createParallelGroup(
																				Alignment.LEADING,
																				false)
																		.addGroup(
																				gl_entryPanel
																						.createParallelGroup(
																								Alignment.BASELINE,
																								false)
																						.addComponent(
																								vendorPanel1,
																								GroupLayout.PREFERRED_SIZE,
																								60,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								sizePanel1,
																								GroupLayout.PREFERRED_SIZE,
																								60,
																								GroupLayout.PREFERRED_SIZE))
																		.addComponent(
																				colorPanel1,
																				GroupLayout.PREFERRED_SIZE,
																				60,
																				GroupLayout.PREFERRED_SIZE)
																		.addComponent(
																				categoryPanel1,
																				GroupLayout.PREFERRED_SIZE,
																				60,
																				GroupLayout.PREFERRED_SIZE))
														.addComponent(
																catalogPanel,
																GroupLayout.PREFERRED_SIZE,
																60,
																GroupLayout.PREFERRED_SIZE))
										.addGroup(
												gl_entryPanel
														.createParallelGroup(
																Alignment.TRAILING)
														.addGroup(
																gl_entryPanel
																		.createSequentialGroup()
																		.addGroup(
																				gl_entryPanel
																						.createParallelGroup(
																								Alignment.TRAILING)
																						.addGroup(
																								gl_entryPanel
																										.createSequentialGroup()
																										.addGap(2)
																										.addComponent(
																												pricePanel,
																												GroupLayout.PREFERRED_SIZE,
																												66,
																												Short.MAX_VALUE))
																						.addGroup(
																								gl_entryPanel
																										.createSequentialGroup()
																										.addPreferredGap(
																												ComponentPlacement.RELATED)
																										.addComponent(
																												qtyPanel,
																												GroupLayout.PREFERRED_SIZE,
																												62,
																												GroupLayout.PREFERRED_SIZE)))
																		.addGap(2))
														.addGroup(
																gl_entryPanel
																		.createSequentialGroup()
																		.addGap(36)
																		.addGroup(
																				gl_entryPanel
																						.createParallelGroup(
																								Alignment.LEADING)
																						.addGroup(
																								gl_entryPanel
																										.createParallelGroup(
																												Alignment.BASELINE)
																										.addComponent(
																												resetEntryButton,
																												GroupLayout.PREFERRED_SIZE,
																												28,
																												GroupLayout.PREFERRED_SIZE)
																										.addComponent(
																												addEntryButton))
																						.addComponent(
																								updateEntryButton))
																		.addContainerGap()))));

		priceTextField = new JFormattedTextField(new DecimalFormat("###,####,####.##"));
		priceTextField.setColumns(10);
		priceTextField.setBackground(new Color(248, 248, 255));
		GroupLayout gl_pricePanel = new GroupLayout(pricePanel);
		gl_pricePanel.setHorizontalGroup(gl_pricePanel.createParallelGroup(
				Alignment.LEADING).addGroup(
				gl_pricePanel
						.createSequentialGroup()
						.addContainerGap()
						.addComponent(priceTextField,
								GroupLayout.PREFERRED_SIZE, 143,
								GroupLayout.PREFERRED_SIZE)
						.addContainerGap(GroupLayout.DEFAULT_SIZE,
								Short.MAX_VALUE)));
		gl_pricePanel.setVerticalGroup(gl_pricePanel.createParallelGroup(
				Alignment.LEADING).addGroup(
				gl_pricePanel
						.createSequentialGroup()
						.addComponent(priceTextField,
								GroupLayout.PREFERRED_SIZE, 25,
								GroupLayout.PREFERRED_SIZE)
						.addContainerGap(22, Short.MAX_VALUE)));
		pricePanel.setLayout(gl_pricePanel);
		entryPanel.setLayout(gl_entryPanel);

		 clearEntryButton = new JButton();
		clearEntryButton.setText("Clear Entry");
		clearEntryButton.setActionCommand("clearEntryButton");
		clearEntryButton.addActionListener(this);

		GroupLayout gl_invTablePanel = new GroupLayout(invTablePanel);
		gl_invTablePanel
				.setHorizontalGroup(gl_invTablePanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_invTablePanel
										.createSequentialGroup()
										.addGroup(
												gl_invTablePanel
														.createParallelGroup(
																Alignment.LEADING)
														.addComponent(
																invTableScrollPane,
																GroupLayout.DEFAULT_SIZE,
																776,
																Short.MAX_VALUE)
														.addGroup(
																gl_invTablePanel
																		.createSequentialGroup()
																		.addGap(258)
																		.addComponent(
																				deleteEntryButton,
																				GroupLayout.PREFERRED_SIZE,
																				106,
																				GroupLayout.PREFERRED_SIZE)
																		.addGap(29)
																		.addComponent(
																				clearEntryButton,
																				GroupLayout.PREFERRED_SIZE,
																				106,
																				GroupLayout.PREFERRED_SIZE)))
										.addContainerGap()));
		gl_invTablePanel
				.setVerticalGroup(gl_invTablePanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_invTablePanel
										.createSequentialGroup()
										.addComponent(invTableScrollPane,
												GroupLayout.PREFERRED_SIZE,
												133, GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												ComponentPlacement.RELATED)
										.addGroup(
												gl_invTablePanel
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																deleteEntryButton)
														.addComponent(
																clearEntryButton))
										.addContainerGap()));
		invTablePanel.setLayout(gl_invTablePanel);

		JButton btnClearColor = new JButton("Clear Color");
		btnClearColor.setActionCommand("btnClearColor");
		btnClearColor.addActionListener(this);

		JButton btnClearSize = new JButton("Clear Size");
		btnClearSize.setActionCommand("btnClearSize");
		btnClearSize.addActionListener(this);

		JButton btnClearVendor = new JButton("Clear Vendor");
		btnClearVendor.setActionCommand("btnClearVendor");
		btnClearVendor.addActionListener(this);

		JButton btnClearCatalog = new JButton("Clear Catalog");
		btnClearCatalog.setActionCommand("btnClearCatalog");
		btnClearCatalog.addActionListener(this);

		JButton btnClearCategory = new JButton("Clear Category");
		btnClearCategory.setActionCommand("btnClearCategory");
		btnClearCategory.addActionListener(this);

		GroupLayout gl_invFieldsPanel = new GroupLayout(invFieldsPanel);
		gl_invFieldsPanel
				.setHorizontalGroup(gl_invFieldsPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_invFieldsPanel
										.createSequentialGroup()
										.addGap(3)
										.addComponent(catalogScrollPane,
												GroupLayout.PREFERRED_SIZE,
												140, GroupLayout.PREFERRED_SIZE)
										.addGap(18)
										.addComponent(categoriesScrollPane,
												GroupLayout.PREFERRED_SIZE,
												140, GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												ComponentPlacement.RELATED)
										.addComponent(colorsScrollPane,
												GroupLayout.PREFERRED_SIZE,
												140, GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												ComponentPlacement.UNRELATED)
										.addComponent(vendorsScrollPane,
												GroupLayout.PREFERRED_SIZE,
												140, GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												ComponentPlacement.RELATED)
										.addComponent(sizesScrollPane,
												GroupLayout.PREFERRED_SIZE,
												140, GroupLayout.PREFERRED_SIZE)
										.addGap(6)
										.addGroup(
												gl_invFieldsPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addComponent(
																btnClearColor,
																GroupLayout.PREFERRED_SIZE,
																119,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnClearCategory,
																GroupLayout.PREFERRED_SIZE,
																119,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnClearVendor,
																GroupLayout.PREFERRED_SIZE,
																116,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnClearSize,
																GroupLayout.PREFERRED_SIZE,
																119,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btnClearCatalog,
																GroupLayout.DEFAULT_SIZE,
																119,
																Short.MAX_VALUE))
										.addContainerGap()));
		gl_invFieldsPanel
				.setVerticalGroup(gl_invFieldsPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_invFieldsPanel
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												gl_invFieldsPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_invFieldsPanel
																		.createSequentialGroup()
																		.addComponent(
																				btnClearCatalog)
																		.addPreferredGap(
																				ComponentPlacement.RELATED)
																		.addComponent(
																				btnClearCategory)
																		.addGap(6)
																		.addComponent(
																				btnClearColor)
																		.addGap(6)
																		.addComponent(
																				btnClearVendor)
																		.addPreferredGap(
																				ComponentPlacement.RELATED)
																		.addComponent(
																				btnClearSize))
														.addGroup(
																gl_invFieldsPanel
																		.createParallelGroup(
																				Alignment.TRAILING)
																		.addGroup(
																				gl_invFieldsPanel
																						.createParallelGroup(
																								Alignment.BASELINE)
																						.addComponent(
																								colorsScrollPane,
																								GroupLayout.PREFERRED_SIZE,
																								170,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								catalogScrollPane,
																								GroupLayout.PREFERRED_SIZE,
																								170,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								categoriesScrollPane,
																								GroupLayout.PREFERRED_SIZE,
																								170,
																								GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								vendorsScrollPane,
																								GroupLayout.PREFERRED_SIZE,
																								170,
																								GroupLayout.PREFERRED_SIZE))
																		.addComponent(
																				sizesScrollPane,
																				GroupLayout.PREFERRED_SIZE,
																				170,
																				GroupLayout.PREFERRED_SIZE)))
										.addContainerGap(27, Short.MAX_VALUE)));
		invFieldsPanel.setLayout(gl_invFieldsPanel);
		initPane.setLayout(gl_initPane);
	}

	private class TableSelectionListener implements ListSelectionListener {
		JTable jtable = null;

		public TableSelectionListener(JTable table) {
			this.jtable = table;
		}

		public void valueChanged(ListSelectionEvent e) {
			int firstIndex = e.getFirstIndex();
			int lastIndex = e.getLastIndex();
			int selRow = jtable.getSelectedRow();
			selIndxEntry = selRow;

			// If cell selection is enabled, both row and column change events
			// are fired
			if (e.getSource() == jtable.getSelectionModel()
					&& jtable.getRowSelectionAllowed()) {
				/*
				 * System.out.println("ABC jtable.getSelectionModel() :: "+jtable
				 * .getSelectionModel() +"\n\tSource :: "+e.getSource()
				 * +"\n\tRowSelectionAllowed :: "
				 * +jtable.getRowSelectionAllowed() +"\n\tselRow :: "+selRow +
				 * "\n\tfirstIndex :: "+firstIndex +
				 * "\n\tlastIndex :: "+lastIndex);
				 */

				clearInventoryFields();
				selIndxEntry = selRow;
				if (selRow != -1) {
					selectedEntry = inventory.getInventoryItems().get(
							selIndxEntry);
					setField();
					addEntryButton.setEnabled(false);
					updateEntryButton.setEnabled(true);
					deleteEntryButton.setEnabled(true);
					resetEntryButton.setEnabled(true);
					
				//	System.out.println(selRow + " :: " + selectedEntry);
				}

			} else if (e.getSource() == jtable.getColumnModel()
					.getSelectionModel() && jtable.getColumnSelectionAllowed()) {
				// Do Nothing with selected columns
			}

			if (e.getValueIsAdjusting()) {
				// The mouse button has not yet been released
			}

		}
	}

	/*
	 * private class ColumnListener implements ListSelectionListener { public
	 * void valueChanged(ListSelectionEvent event) { if
	 * (event.getValueIsAdjusting()) { return; }
	 * //System.out.println("COLUMN SELECTION EVENT. "); //outputSelection(); }
	 * }
	 */
	private void setField() {
		if (selectedEntry != null) {
			if (selectedEntry.getColor() != null) {
				selectedColor = selectedEntry.getColor();
				colorTextField.setText(selectedColor.color_name);
				colorTextField.setForeground(Color.BLACK);
				selIndxColor = this.configInventoryFieldsControl.getSelIndex("color", selectedColor.color_id);
				colors_jList.setSelectedIndex(selIndxColor);
			}
			if (selectedEntry.getCatalogItem() != null) {
				selectedCatlgItem = selectedEntry.getCatalogItem();
				catalogTextField.setText(selectedCatlgItem.catlg_item_name);
				catalogTextField.setForeground(Color.BLACK);
				selIndxCatlgItem = this.configInventoryFieldsControl.getSelIndex("catalogitem", selectedCatlgItem.catlg_item_id);
				itemCatalog_jList
						.setSelectedIndex(selIndxCatlgItem);
			}
		//	System.out.println(selectedEntry.getDebugString());
			if (selectedEntry.getItemCategory() != null) {
				selectedItemCategory = selectedEntry.getItemCategory();
				//System.out.println("\t selectedItemCategory: "+selectedItemCategory);
				categoryTextField
						.setText(selectedEntry.getItemCategory().itemCategory_name);
				categoryTextField.setForeground(Color.BLACK);
				selIndxItemCategory = this.configInventoryFieldsControl.getSelIndex("itemcategory", selectedItemCategory.itemCategory_id);
				categories_jList
						.setSelectedIndex(selIndxItemCategory);
			}
			if (selectedEntry.getSize() != null) {
				selectedSize = selectedEntry.getSize();
				sizeTextField.setText(selectedSize.size_name);
				sizeTextField.setForeground(Color.BLACK);
				selIndxSize = this.configInventoryFieldsControl.getSelIndex("size", selectedSize.size_id);
				sizes_jList.setSelectedIndex(selIndxSize);
			}
			if (selectedEntry.getVendor() != null) {
				selectedVendor = selectedEntry.getVendor();
				vendorTextField.setText(selectedVendor.vendor_name);
				vendorTextField.setForeground(Color.BLACK);
				selIndxVendor = this.configInventoryFieldsControl.getSelIndex("vendor", selectedVendor.vendor_id);
				vendors_jList.setSelectedIndex(selIndxVendor);
			}

			priceTextField.setText(new Double(selectedEntry.getPrice())
					.toString());
			quantityTextField.setText(new Integer(selectedEntry.getQuantity())
					.toString());
		}
	}

	/**
	 * @return ListSelectionListener for sizes_jList
	 */
	private ListSelectionListener createSizesListSelectionListener() {
		return new ListSelectionListener() {
			public void valueChanged(ListSelectionEvent e) {
				selectedSize = (Size) sizes_jList.getSelectedValue();
				if (selectedSize != null) {
					sizeTextField.setText(selectedSize.toString());
					sizeTextField.setForeground(Color.BLUE);
					selIndxSize = sizes_jList.getSelectedIndex();
				}
			}
		};
	}

	/**
	 * @return ListSelectionListener for catalog_jList
	 */
	private ListSelectionListener createItemCatalogListSelectionListener() {
		return new ListSelectionListener() {

			public void valueChanged(ListSelectionEvent e) {
				selectedCatlgItem = (CatalogItem) itemCatalog_jList
						.getSelectedValue();
				if (selectedCatlgItem != null) {
					catalogTextField.setText(selectedCatlgItem.toString());
					catalogTextField.setForeground(Color.BLUE);
					selIndxCatlgItem = itemCatalog_jList.getSelectedIndex();
				}
			}
		};
	}

	/**
	 * @return ListSelectionListener for categories_jList
	 */
	private ListSelectionListener createItemCategoryListSelectionListener() {
		return new ListSelectionListener() {
			public void valueChanged(ListSelectionEvent e) {
				selectedItemCategory = (ItemCategory) categories_jList
						.getSelectedValue();
				if (selectedItemCategory != null) {
					categoryTextField.setText(selectedItemCategory.toString());
					categoryTextField.setForeground(Color.BLUE);
					selIndxItemCategory = categories_jList.getSelectedIndex();
				}
			}
		};
	}

	/**
	 * @return ListSelectionListener for colors_jList
	 */
	private ListSelectionListener createColorsListSelectionListener() {
		return new ListSelectionListener() {
			public void valueChanged(ListSelectionEvent e) {
				selectedColor = (InvColor) colors_jList.getSelectedValue();
				if (selectedColor != null) {
					colorTextField.setText(selectedColor.toString());
					colorTextField.setForeground(Color.BLUE);
					selIndxColor = colors_jList.getSelectedIndex();
				}
			}
		};
	}

	/**
	 * @return ListSelectionListener for vendors_jList
	 */
	private ListSelectionListener createVendorsListSelectionListener() {
		return new ListSelectionListener() {
			public void valueChanged(ListSelectionEvent e) {
				selectedVendor = (Vendor) vendors_jList.getSelectedValue();
				if (selectedVendor != null) {
					vendorTextField.setText(selectedVendor.toString());
					vendorTextField.setForeground(Color.BLUE);
					selIndxVendor = vendors_jList.getSelectedIndex();
				}
			}
		};
	}

	private void clearItemCatalog() {
		catalogTextField.setText("");
		catalogTextField.setForeground(Color.BLACK);
		selIndxCatlgItem = -1;
		if (itemCatalog_jList.getSelectedValue() != null) {
			// addCatlgItemButton.setEnabled(true);
			itemCatalog_jList.clearSelection();
			selectedCatlgItem = null;
		}
	}

	private void clearColor() {
		colorTextField.setText("");
		colorTextField.setForeground(Color.BLACK);
		selIndxColor = -1;
		if (colors_jList.getSelectedValue() != null) {
			// addColorButton.setEnabled(true);
			colors_jList.clearSelection();
			selectedColor = null;
		}
	}

	private void clearSize() {
		sizeTextField.setText("");
		sizeTextField.setForeground(Color.BLACK);
		selIndxSize = -1;
		if (sizes_jList.getSelectedValue() != null) {
			// addSizeButton.setEnabled(true);
			sizes_jList.clearSelection();
			selectedSize = null;
		}
	}

	private void clearItemCategory() {
		categoryTextField.setText("");
		categoryTextField.setForeground(Color.BLACK);
		selIndxItemCategory = -1;
		if (categories_jList.getSelectedValue() != null) {
			// addItemCategoryButton.setEnabled(true);
			categories_jList.clearSelection();
			selectedItemCategory = null;
		}
	}

	private void clearVendor() {
		vendorTextField.setText("");
		vendorTextField.setForeground(Color.BLACK);
		selIndxVendor = -1;
		if (vendors_jList.getSelectedValue() != null) {
			// addVendorButton.setEnabled(true);
			vendors_jList.clearSelection();
			selectedVendor = null;
		}
	}

	private void resetEntry() {
		clearInventoryFields();
		if (selIndxEntry != -1) {
			selectedEntry = this.inventory.getInventoryItems().get(selIndxEntry);
			setField();
		}
	}

	private void clearEntry() {
		selIndxEntry = -1;
		selectedEntry = null;
		invTable.clearSelection();
		addEntryButton.setEnabled(true);
		updateEntryButton.setEnabled(false);
		deleteEntryButton.setEnabled(false);
		resetEntryButton.setEnabled(false);
		clearInventoryFields();
	}

	private void clearInventoryFields() {
		clearColor();
		clearSize();
		clearVendor();
		clearItemCatalog();
		clearItemCategory();
		clearPrice();
		clearQuantity();
	}

	private void clearPrice() {
		priceTextField.setText("");
		priceTextField.setForeground(Color.BLACK);

	}

	private void clearQuantity() {
		quantityTextField.setText("");
		quantityTextField.setForeground(Color.BLACK);
	}

	private boolean updateEntry() {
		boolean isSuccess = true;
		if (selectedEntry != null) {

			if (selectedCatlgItem == null) {
				// Do Nothing
			} else {
				selectedEntry.setCatalogItem(selectedCatlgItem);

				if (selectedItemCategory != null) {
					selectedEntry.setItemCategory(selectedItemCategory);
				} else {
					selectedEntry.setItemCategory(null);
				}

				if (selectedColor != null) {
					selectedEntry.setColor(selectedColor);
				} else {
					selectedEntry.setColor(null);
				}

				if (selectedVendor != null) {
					selectedEntry.setVendor(selectedVendor);
				} else {
					selectedEntry.setVendor(null);
				}

				if (selectedSize != null) {
					selectedEntry.setSize(selectedSize);
				} else {
					selectedEntry.setSize(null);
				}

				if (priceTextField.getText() != null
						&& priceTextField.getText().length() > 0) {
					try {
						selectedEntry.setPrice(new Double(priceTextField
								.getText()));
					} catch (Exception e) {

					}
				} else {
					selectedEntry.setPrice(0);
				}
				if (quantityTextField.getText() != null
						&& quantityTextField.getText().length() > 0) {
					try {
						selectedEntry.setQuantity(new Integer(quantityTextField
								.getText()));
					} catch (Exception e) {

					}
				} else {
					selectedEntry.setQuantity(0);
				}
				isSuccess = this.inventory
						.updateDBEntry(selectedEntry, selIndxEntry);
				invTable.setModel(this.inventory);
			}
		}
		invTable.repaint();
		return isSuccess;
	}

	private boolean addEntry() {
		boolean isSuccess = true;
		InventoryEntry newEntry = new InventoryEntry();
		if (newEntry != null) {
			if (selectedCatlgItem == null) {
				// Do Nothing
			} else {
				newEntry.setCatalogItem(selectedCatlgItem);
				if (selectedItemCategory != null) {
					newEntry.setItemCategory(selectedItemCategory);
				} else {
					newEntry.setItemCategory(null);
				}

				if (selectedColor != null) {
					newEntry.setColor(selectedColor);
				} else {
					newEntry.setColor(null);
				}

				if (selectedVendor != null) {
					newEntry.setVendor(selectedVendor);
				} else {
					newEntry.setVendor(null);
				}

				if (selectedSize != null) {
					newEntry.setSize(selectedSize);
				} else {
					newEntry.setSize(null);
				}

				if (priceTextField.getText() != null
						&& priceTextField.getText().length() > 0) {
					try {
						newEntry.setPrice(new Double(priceTextField.getText()));
					} catch (Exception e) {

					}
				} else {
					newEntry.setPrice(0);
				}
				if (quantityTextField.getText() != null
						&& quantityTextField.getText().length() > 0) {
					try {
						newEntry.setQuantity(new Integer(quantityTextField
								.getText()));
					} catch (Exception e) {

					}
				} else {
					newEntry.setQuantity(0);
				}
				isSuccess = this.inventory.addDbEntry(newEntry);
				invTable.setModel(this.inventory);
			}
		}
		invTable.repaint();
		return isSuccess;
	}

	private boolean deleteEntry() {
		boolean isSuccess = true;
		if (selectedEntry != null && selIndxEntry > -1) {
			isSuccess = this.inventory.deleteDbEntry(selectedEntry,
					selIndxEntry);
			invTable.setModel(this.inventory);
		}
		invTable.repaint();
		return isSuccess;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getActionCommand().equalsIgnoreCase("newCfgItmSpecsButton")) {
			super.destroy();
			configInventoryFieldsView = new ConfigInventoryFieldsView();
		}
		if (e.getActionCommand().equalsIgnoreCase("btnClearCatalog")) {
			clearItemCatalog();
		}
		if (e.getActionCommand().equalsIgnoreCase("btnClearColor")) {
			clearColor();
		}
		if (e.getActionCommand().equalsIgnoreCase("btnClearSize")) {
			clearSize();
		}
		if (e.getActionCommand().equalsIgnoreCase("btnClearCategory")) {
			clearItemCategory();
		}
		if (e.getActionCommand().equalsIgnoreCase("btnClearVendor")) {
			clearVendor();
		}
		// if (e.getActionCommand().equalsIgnoreCase("selectEntryButton")) {

		// }
		if (e.getActionCommand().equalsIgnoreCase("deleteEntryButton")) {
			deleteEntry();
			clearEntry();
		}
		if (e.getActionCommand().equalsIgnoreCase("updateEntryButton")) {
			updateEntry();
			clearEntry();
			
		}
		if (e.getActionCommand().equalsIgnoreCase("addEntryButton")) {
			addEntry();
			clearEntry();
		}
		if (e.getActionCommand().equalsIgnoreCase("resetEntryButton")) {
			resetEntry();
		}
		if (e.getActionCommand().equalsIgnoreCase("clearEntryButton")) {
			clearEntry();
		}

	}
}
